package com.flexcloudsdk.xmpp;
import java.util.logging.Logger;

import com.google.appengine.api.xmpp.Presence;
import com.google.appengine.api.xmpp.PresenceShow;
import com.google.appengine.api.xmpp.PresenceType;
import com.google.appengine.api.xmpp.JID;

public class CloudPresence {
	private static final Logger log = Logger.getLogger(CloudPresence.class.getName());
	private Presence presence = null;
	
	public CloudPresence() {
		log.info("CloudPresence has been created by BlazeDS");
	}

	public void setPresence(Presence value) {
		presence = value;
		if (presence == null)
			log.severe("setPresence was passed a null presence value in CLoudPresence!");
	}
	
	public boolean isAvialable() {
		boolean flag = false;
		if (presence != null)
			flag = presence.isAvailable();
		else
			log.severe("isAvialable call failed due to null presence in CloudPresence!");
		return flag;
	}
	
	public JID getFromJid() {
		JID jid = null;
		if (presence != null)
			jid =  presence.getFromJid();
		else
			log.severe("getFromJid call failed due to null presence in CloudPresence!");
		return jid;
	} 

	public JID getToJid() {
		JID jid = null;
		if (presence != null)
			jid =  presence.getToJid();
		else
			log.severe("getToJid call failed due to null presence in CloudPresence!");
		return jid;
	} 
	
	public  PresenceShow getPresenceShow() {
		PresenceShow show = null;
		if (presence != null)
			show = presence.getPresenceShow();
		else
			log.severe("getPresenceShow call failed due to null presence in CloudPresence!");
		return show;
	}
	
	public PresenceType getPresenceType() {
		PresenceType  type = null;
		if (presence != null)
		  type =  presence.getPresenceType();
		else
			log.severe("getPresenceType call failed due to null presence in CloudPresence!");
		return type;
	}
	
	public String getStanza() {
		String value = null;
		if (presence != null)
			value = presence.getStanza();
		else
			log.severe("getStanza call failed due to null presence in CloudPresence!");
		return value;
	}

	public String getStatus() {
		String status = null;
		if (presence != null)
			status = 	presence.getStatus();
		else
			log.severe("getStatus call failed due to null presence in CloudPresence!");
		return status;
	}
}
